﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExcellData;
using Microsoft.Office.Interop.Excel;
using System.Reflection;
using System.Collections;

namespace ExcelUtilities12
{
	public class ExcelIntegration : IExcelIntegration
	{
		private static ExcelIntegration _Instance;
		private Application _ExcelApplication;

		public static IExcelIntegration Instance
		{
			get
			{
				if (_Instance == null)
					_Instance = new ExcelIntegration();
				return _Instance;
			}
		}

		private ExcelIntegration()
		{
			_ExcelApplication = new Application();
		}

		public void Quit()
		{
			_ExcelApplication.Quit();
		}

		#region IExcelIntegration Members

		public IWorkbook CreateWorkbook(object template)
		{
			return new Workbook12(_ExcelApplication.Workbooks.Add(template));
		}

		public bool Visible
		{
			get { return _ExcelApplication.Visible; }
			set { _ExcelApplication.Visible = value; }
		}

		#endregion
	}
}
